package edu.rpi.tw.impav;

import javax.swing.JLabel;

import controlP5.ControlEvent;
import controlP5.ControlListener;
import controlP5.ControlP5;
import controlP5.Slider;

public class OptionsPanel extends ControlP5 {

    JLabel lifetimeLabel;
    
    JLabel importanceLabel;

    private Slider lifetimeSlider;

    private Slider importanceSlider;

    protected float lifetime = 0.5f;

    protected float tfidf = 0;
    
    public void setup() {
        lifetimeSlider = this.addSlider("lifetime", 0f,60f,lifetime,5, 5, 200, 15);
        lifetimeSlider.setCaptionLabel("Tweet Lifetime (minutes)");
        lifetimeSlider.addListener(new ControlListener() {
            @Override
            public void controlEvent(ControlEvent event) {
                lifetime = (long)event.value();
            }
        });
        importanceSlider = this.addSlider("importance", 0f,0.5f,tfidf,5, 25, 200, 15);
        importanceSlider.setCaptionLabel("Min Importance (TF-IDF)");
        importanceSlider.addListener(new ControlListener() {
            @Override
            public void controlEvent(ControlEvent event) {
                tfidf = event.value();
            }
        });
    }
    
    public OptionsPanel(App app) {
        super(app);
    }
    
    public long getLifetime() {
        return (long)(lifetime * 60000);
    }
    
    public float getMinTfidf() {
        return tfidf;
    }
}
